package com.example.home7.server;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

public class MusicLuaLuaLua2 extends Service {
    public MusicLuaLuaLua2() {
    }

    private MuSicAid aid = null;
    public class MyBinder extends Binder{
        private MusicLuaLuaLua2 lua;
        public MyBinder(MusicLuaLuaLua2 lua) {
            this.lua = lua;
        }
        public void play(){lua.aid.begin();}
        public void destroy(){lua.aid.destroy();}
        public void next(){lua.aid.next();}
        public void pause(){lua.aid.pause();}
    }
    @Override
    public IBinder onBind(Intent intent) {
        return new MyBinder(this);
    }

    @Override
    public void onCreate() {
        super.onCreate();
        aid = new MuSicAid(this);
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        aid.begin();
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        aid.destroy();
        aid = null;
    }
}